package com.api.wall.unlike;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IWallApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = "classpath:/wall/wall-inbox.xml")
public class Unlike extends AbstractApiTest {

	@Value("#{user_toLike.appId}")
	private String userUrn;

	@Value("#{user_toLike.password}")
	private String userPassword;

	@Value("#{org_inboxwall[contact].appId}")
	private String contactUrn;

	@Value("#{user_toLike.password}")
	private String contactPassword;

	private String eventUrn;

	@BeforeClass
	protected void setParameters() throws Exception {
		getApi().login(contactUrn, contactPassword);

		List<String> usersToNotify = new ArrayList<String>();
		usersToNotify.add(userUrn);

		String privateComment = getApi().getService(IWallApiService.class).publishPrivateComment("comment", null, null, null, null,
				usersToNotify);

		this.eventUrn = privateComment;

		getApi().login(userUrn, userPassword);
	}

	@Test
	public void testPublishCompanyFeed() throws ZyncroApiException {

		String result = getApi().getService(IWallApiService.class).unlike(eventUrn);

		Assert.assertNotNull(result);
	}
}
